using System;
using System.Collections.Generic;
using System.Text;

using PickGold.Database;

namespace PickGold.Entities.Table
{
    public class CBaseUserDomain : CBaseTable
    {
        public const string ENTITY_NAME = "tb_sys_user_domain";
        public const string ENTITY_ALIAS = "domains";
		public const string ENTITY_KEY = "domain_id";
		public const string ENTITY_SYMBOL = "domain_name";
        //
        public const string USER_ID = CBaseUserInfo.ENTITY_KEY;
        public const string ITEM_DOMAIN = "item_domain";
		public const string PATH_ID = CBasePathInfo.ENTITY_KEY;
        public const string ITEM_PATH = "item_path";
        public const string ITEM_IP = "item_ip";
        public const string ITEM_ORDER = "item_order";
        //
        private SBaseUserDomain _ = null;
        //
        public CBaseUserDomain() : base(ENTITY_NAME) { }
        public CBaseUserDomain(CDatabase db) : base(db, ENTITY_NAME) { }
        public CBaseUserDomain(string alias) : base(ENTITY_NAME, alias) { }
		public CBaseUserDomain(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseUserDomain());
        }
        protected void SetSchema(SBaseUserDomain s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(USER_ID, typeof(long)).DefaultValue = this._.UserID;
            this._DataTable.Columns.Add(ITEM_DOMAIN, typeof(string)).MaxLength = 255;
            this._DataTable.Columns.Add(PATH_ID, typeof(long)).DefaultValue = this._.PathID;
            this._DataTable.Columns.Add(ITEM_PATH, typeof(string)).MaxLength = 255;
            this._DataTable.Columns.Add(ITEM_IP, typeof(long)).DefaultValue = this._.ItemIP;
            this._DataTable.Columns.Add(ITEM_ORDER, typeof(int)).DefaultValue = this._.ItemOrder;
        }
        //
        #region Property
        //
        public long UserID
        {
            set
            {
                this._.UserID = value;
                this.SetValue(USER_ID, value);
            }
            get
            {
                return this._.UserID;
            }
        }
        //
		public string ItemDomain
        {
            set
            {
                this._.ItemDomain = value;
                this.SetValue(ITEM_DOMAIN, value);
            }
            get
            {
                return this._.ItemDomain;
            }
        }
        //
		public long PathID
        {
            set
            {
                this._.PathID = value;
                this.SetValue(PATH_ID, value);
            }
            get
            {
				return this._.PathID;
            }
        }
        //
		public string ItemPath
        {
            set
            {
                this._.ItemPath = value;
                this.SetValue(ITEM_PATH, value);
            }
            get
            {
				return this._.ItemPath;
            }
        }
        //
		public long ItemIP
        {
            set
            {
                this._.ItemIP = value;
                this.SetValue(ITEM_IP, value);
            }
            get
            {
				return this._.ItemIP;
            }
        }
        //
		public int ItemOrder
        {
            set
            {
                this._.ItemOrder = value;
                this.SetValue(ITEM_ORDER, value);
            }
            get
            {
				return this._.ItemOrder;
            }
        }
        //
        #endregion
        //
        public override bool MoveTo(int position)
        {
            if (!base.MoveTo(position))
                return false;
            this._.UserID = this.GetValue<long>(USER_ID);
            this._.ItemDomain = this.GetValue<string>(ITEM_DOMAIN);
            this._.PathID = this.GetValue<long>(PATH_ID);
            this._.ItemPath = this.GetValue<string>(ITEM_PATH);
            this._.ItemIP = this.GetValue<int>(ITEM_IP);
            this._.ItemOrder = this.GetValue<int>(ITEM_ORDER);
            return true;
        }
        //
    }
    //
    public class SBaseUserDomain : SBaseTable
    {
        //
        public long UserID = -1;
        public string ItemDomain = null;
        public long PathID = -1;
		public string ItemPath = null;
		public long ItemIP = 0;
        public int ItemOrder = 0;
        //
    }
    //
}
//
